/*
 * Copyright (c) Jiandong.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */


import { TypescriptModuleWrapper } from './TypescriptModuleWrapper';
import HashSet from '@ohos.util.HashSet';
import { JavaScriptExecutor } from './JavaScriptExecutor';
import { ReactCallback } from './ReactCallback';
export class CatalystInstanceImplNative {
  private readonly mEnableRuntimeScheduler: boolean;
  private readonly mEnableRuntimeSchedulerInTurboModule: boolean

  constructor(enableRuntimeScheduler: boolean,enableRuntimeSchedulerInTurboModule: boolean) {
    this.mEnableRuntimeScheduler = enableRuntimeScheduler
    this.mEnableRuntimeSchedulerInTurboModule = enableRuntimeSchedulerInTurboModule
  }

  initializeBridge(callback: ReactCallback, jse: JavaScriptExecutor, jsQueue: JSQueueThread, moduleQueue: nati, javaModules: HashSet<TypescriptModuleWrapper>): void {

  }

  extendNativeModules(javaModules: hashSet<JavaModuleWrapper>);

  /**
   * Sets the source URL of the underlying bridge without loading any JS code.
   */
  setSourceURL(sourceURL: string): void;


  loadScriptFromAssets(
  jni::alias_ref<JAssetManager::javaobject> assetManager,
  const std::string &assetURL,
  bool loadSynchronously);
  void jniLoadScriptFromFile(
  const std::string &fileName,
  const std::string &sourceURL,
  bool loadSynchronously);
  void jniCallJSFunction(
  std::string module,
  std::string method,
  NativeArray *arguments);
  void jniCallJSCallback(jint callbackId, NativeArray *arguments);
  jni::alias_ref<CallInvokerHolder::javaobject> getJSCallInvokerHolder();
  jni::alias_ref<CallInvokerHolder::javaobject> getNativeCallInvokerHolder();
  jni::alias_ref<JRuntimeExecutor::javaobject> getRuntimeExecutor();
  jni::alias_ref<JRuntimeScheduler::javaobject> getRuntimeScheduler();
  void setGlobalVariable(std::string propName, std::string &&jsonValue);
  jlong getJavaScriptContext();
//  void handleMemoryPressure(int pressureLevel);
//
//  void createAndInstallRuntimeSchedulerIfNecessary();

  // This should be the only long-lived strong reference, but every C++ class
  // will have a weak reference.
  std::shared_ptr<Instance> instance_;
  std::shared_ptr<ModuleRegistry> moduleRegistry_;
  std::shared_ptr<JMessageQueueThread> moduleMessageQueue_;
  jni::global_ref<CallInvokerHolder::javaobject> jsCallInvokerHolder_;
  jni::global_ref<CallInvokerHolder::javaobject> nativeCallInvokerHolder_;
  jni::global_ref<JRuntimeExecutor::javaobject> runtimeExecutor_;
  jni::global_ref<JRuntimeScheduler::javaobject> runtimeScheduler_;

}
;
